You incorporate streaming content in a client movie by adding at least one streaming track. The simplest form of client movie has only one track: a streaming track with the URL of a movie on a server.
A streaming track has a media type of kQTSStreamMediaType ('strm') and contains a single media sample: typically either an RTSP:// URL of a streaming movie or the SDP text describing a multicast.
The following code example shows how to create a streaming track, insert a sample description, and add a URL media sample.
Listing 5 Creating a streaming ('strm') track with an RTSP:// URL
Handle dataRef;
long dataLength;
char url[] = "rtsp://myserver.bigcompany.com/mystreaming.mov";
dataRef = NewHandle(strlen(url) + 1);
BlockMoveData(url, *urlDataRef, strlen(url) + 1);
dataLength = GetHandleSize(dataRef);
newMedia = NewTrackMedia(newTrack, kQTSStreamMediaType,
kQTSMediaTimeScale, handleDataRef, HandleDataHandlerSubType);
err = BeginMediaEdits(newMedia);
qtsDesc =
(QTSSampleDescriptionHandle)NewHandleClear(sizeof(QTSSampleDescription));
(**qtsDesc).descSize = sizeof(QTSSampleDescription);
(**qtsDesc).dataFormat = 'rtsp';
(**qtsDesc).dataRefIndex = 1;
(**qtsDesc).version = kQTSSampleDescriptionVersion;
duration = kQTSInfiniteDuration;
err = AddMediaSample(newMedia, dataRef, 0, dataLength, duration,
(SampleDescriptionHandle)qtsDesc, 1, 0, nil);
err = EndMediaEdits(newMedia);
err = InsertMediaIntoTrack(newTrack, 0, 0, GetMediaDuration(newMedia),
kQTSNormalForwardRate);
A movie that contains streaming tracks can be played from a local disk or served via HTTP. You can create a client movie with a streaming track that contains the URL of a server movie, then embed the client movie in a website or distribute it on a CD-ROM. When the movie is played, the user's computer will establish a network connection to the specified server for each streaming track.
A streaming track in a client movie can point to a server movie containing audio, video, text, and MIDI tracks. Any or all of the tracks in the server movie can appear as a single streaming track in the client movie.
| Previous | Chapter Contents | Chapter Top | Next |